var e = require("../../../../@babel/runtime/helpers/regeneratorRuntime"), t = require("../../../../@babel/runtime/helpers/asyncToGenerator"), i = require("../../../../@babel/runtime/helpers/objectSpread2"), n = require("../../../../common/vendor.js"), r = require("../../../uv-ui-tools/libs/mixin/mpMixin.js"), o = require("../../../uv-ui-tools/libs/mixin/mixin.js");

require("../../../uv-ui-tools/libs/function/index.js"), require("../../../uv-ui-tools/libs/function/test.js"), 
require("../../../uv-ui-tools/libs/function/digit.js"), require("../../../uv-ui-tools/libs/util/route.js"), 
require("../../../uv-ui-tools/libs/function/debounce.js"), require("../../../uv-ui-tools/libs/function/throttle.js");

var a = {
    name: "uv-drop-down-item",
    mixins: [ r.mpMixin, o.mixin ],
    emits: [ "click" ],
    props: {
        name: {
            type: [ String, Number ],
            default: ""
        },
        type: {
            type: [ String, Number ],
            default: "2"
        },
        label: {
            type: [ String ],
            default: ""
        },
        value: {
            type: [ String, Number, null ],
            default: ""
        },
        isDrop: {
            type: Boolean,
            default: !1
        }
    },
    data: function() {
        return {
            parentData: {
                defaultValue: [ 0, "0", "all" ],
                textSize: "30rpx",
                textColor: "#333",
                textActiveSize: "30rpx",
                textActiveColor: "#3c9cff",
                extraIcon: {},
                extraActiveIcon: {},
                sign: "",
                clickHandler: Function
            },
            active: !1,
            isDroped: !1,
            elId: ""
        };
    },
    watch: {
        isDrop: {
            handler: function(e) {
                this.isDroped = e;
            },
            immediate: !0
        },
        value: {
            handler: function(e) {
                this.active = -1 == this.parentData.defaultValue.indexOf(e);
            },
            immediate: !0
        }
    },
    computed: {
        getDownIcon: function() {
            var e, t, n, r, o, a = i({
                size: "30rpx",
                color: "#333"
            }, this.parentData.extraIcon);
            return (this.active || this.isDroped) && (a.color = (null == (e = this.parentData.extraActiveIcon) ? void 0 : e.color) ? null == (t = this.parentData.extraActiveIcon) ? void 0 : t.color : "#3c9cff", 
            a.size = (null == (n = this.parentData.extraActiveIcon) ? void 0 : n.size) ? null == (r = this.parentData.extraActiveIcon) ? void 0 : r.size : "30rpx"), 
            this.isDroped && (a.name = null == (o = this.parentData.extraActiveIcon) ? void 0 : o.name), 
            a;
        },
        getTextStyle: function() {
            var e = {
                size: this.parentData.textSize,
                color: this.parentData.textColor
            };
            return (this.active || this.isDroped) && (e.size = this.parentData.textActiveSize, 
            e.color = this.parentData.textActiveColor), e;
        }
    },
    created: function() {
        this.init();
    },
    methods: {
        init: function() {
            var i = this;
            this.elId = this.$uv.guid(), this.getParentData("uv-drop-down"), this.parent || this.$uv.error("uv-drop-down必须搭配uv-drop-down-item组件使用"), 
            n.index.$on("HANDLE_DROPDOWN_ONE", function(e) {
                i.isDroped && i.elId != e && (i.isDroped = !1);
            }), n.index.$on("".concat(this.parentData.sign, "_CLOSEPOPUP"), t(e().mark(function t() {
                return e().wrap(function(e) {
                    for (;;) switch (e.prev = e.next) {
                      case 0:
                        i.isDroped && (i.isDroped = !1);

                      case 1:
                      case "end":
                        return e.stop();
                    }
                }, t);
            })));
        },
        clickHandler: function() {
            var i = this;
            return t(e().mark(function t() {
                var r;
                return e().wrap(function(e) {
                    for (;;) switch (e.prev = e.next) {
                      case 0:
                        r = {}, e.t0 = (n.index.$emit("HANDLE_DROPDOWN_ONE", i.elId), +i.type), e.next = 1 === e.t0 ? 4 : 2 === e.t0 ? 6 : 7;
                        break;

                      case 4:
                        return i.active = !i.active, r = {
                            name: i.name,
                            active: i.active,
                            type: i.type
                        }, e.abrupt("break", 7);

                      case 6:
                        i.isDroped = !i.isDroped, r = {
                            name: i.name,
                            active: i.isDroped,
                            type: i.type
                        };

                      case 7:
                        i.parentData.clickHandler(r), i.$emit("click", r), n.index.$emit("".concat(i.parentData.sign, "_CLICKMENU"), {
                            show: +i.type > 1 && i.isDroped
                        });

                      case 8:
                      case "end":
                        return e.stop();
                    }
                }, t);
            }))();
        }
    }
};

Array || (n.resolveComponent("uv-text") + n.resolveComponent("uv-icon"))(), Math || (function() {
    return "../../../uv-text/components/uv-text/uv-text.js";
} + function() {
    return "../../../uv-icon/components/uv-icon/uv-icon.js";
})();

var c = n._export_sfc(a, [ [ "render", function(e, t, i, r, o, a) {
    return n.e({
        a: n.p({
            text: i.label,
            size: a.getTextStyle.size,
            color: a.getTextStyle.color,
            lines: "1",
            "custom-style": {
                marginRight: "10rpx",
                maxWidth: "200rpx"
            }
        }),
        b: -1 == [ 1, "1" ].indexOf(i.type)
    }, -1 == [ 1, "1" ].indexOf(i.type) ? {
        c: n.p({
            name: a.getDownIcon.name,
            size: a.getDownIcon.size,
            color: a.getDownIcon.color
        })
    } : {}, {
        d: n.o(function() {
            return a.clickHandler && a.clickHandler.apply(a, arguments);
        })
    });
} ], [ "__scopeId", "data-v-c53c7e38" ] ]);

wx.createComponent(c);